package com.view;

import com.panel.GamePanel;
import com.panel.MyPanel;
import com.util.GameUtil;

import javax.swing.*;
import java.awt.*;

/**
 * @author: Combo
 * @time: 2020/12/31 17:59
 * @description: 游戏主界面
 */
public class GameFrame extends JFrame {
    public static final int WIDTH = 1500;
    public static final int HEIGHT = 900;

    public GameFrame() throws HeadlessException {
        GamePanel panel = new GamePanel();
        panel.start(); // 程序启动
        this.addKeyListener(panel);
        this.add(panel);

        this.setSize(WIDTH, HEIGHT);
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setIconImage(GameUtil.getImage("images/logo.png"));
        this.setUndecorated(true);
        this.setVisible(true);
    }
}
